Improve user-agent header to include telemetry information#583
Improve user-agent header to include telemetry information#583
Conversation
nmuesch
left a comment
There was a problem hiding this comment.
Looks good, two quick comments. Thanks!
tests/integration/api/test_api.py
Outdated
| def test_user_agent(self, dog): | ||
| _, resp = dog.api_client.APIClient.submit('GET', 'validate') | ||
| assert re.match(r'^datadogpy\/[^\s]+ \(python [^\s]+; os [^\s]+; arch [^\s]+\)$', resp.request.headers['User-Agent']) | ||
| resp.request.headers['User-Agent'] |
There was a problem hiding this comment.
Ah, forgotten debugging line, sorry. Will remove.
| passenv = DD_TEST_CLIENT* | ||
| usedevelop = true | ||
| deps = | ||
| !integration: mock |
There was a problem hiding this comment.
I think if we move the user agent test to tests/unit instead of tests/integration we wouldn't need to change deps.
There was a problem hiding this comment.
Yeah, but the whole unittest suite as it is set up now replaces the RequestClient._session, so we'd have to create a completely different setup just because of this one specific test. I don't mind doing that, but this is just simpler (plus it tests the real thing).
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
Hmm, I have also realized that there's a theoretical possibility that someone uses the |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
What does this PR do?
Makes the user-agent header more useful.
Description of the Change
Alternate Designs
Possible Drawbacks
Verification Process
Additional Notes
Release Notes
Review checklist (to be filled by reviewers)
changelog/label attached. If applicable it should have thebackward-incompatiblelabel attached.do-not-merge/label attached.kind/andseverity/labels attached at least.